const mysql = require('mysql');

let config = {
    "host":'192.168.17.144',
    "user":"root",
    "password":"ddd",
    "database":"blog"
}
let con = mysql.createConnection(config);
con.connect();

let obj = {};
obj.query = async function (sqlStr,arr) {
    // con.connection();
    return await new Promise((resolve,reject) => {
        con.query(sqlStr,arr,(e,res) => {
            if (e) {
                reject(e);
            }
            else{
                resolve(res);
            }
        })
    })
    
}
module.exports = obj;